# 导入数据库表
from zapp.models import *
# 导入序列化包
from rest_framework import serializers


# 用户表序列化器
class UserSer(serializers.ModelSerializer):

    class Meta:
        model = User
        exclude = ('first_name', 'last_name', 'is_active', 'is_staff', 'is_superuser')
        depth = 2

# 权限表序列化器
class RightSer(serializers.ModelSerializer):

    class Meta:
        model = Right
        fields = "__all__"
        depth = 1


# 公司表序列化器
class OfficeSer(serializers.ModelSerializer):
    class Meta:
        model = Office
        fields = "__all__"

# 角色表序列化器
class CharacterSer(serializers.ModelSerializer):
    class Meta:
        model = Character
        fields = "__all__"
        depth = 1


# 货物类型表序列化器
class TypeSer(serializers.ModelSerializer):
    class Meta:
        model = Type
        fields = "__all__"

# 报警表序列化器
class AlertSer(serializers.ModelSerializer):
    class Meta:
        model = Alert
        fields = "__all__"
        depth = 1

# 客户表序列化器
class CustomSer(serializers.ModelSerializer):
    class Meta:
        model = Custom
        fields = "__all__"
        depth = 1

# 设备表序列化器
class EquipmentSer(serializers.ModelSerializer):
    class Meta:
        model = Equipment
        fields = "__all__"

# 订单表序列化器
class OrderSer(serializers.ModelSerializer):
    class Meta:
        model = Order
        fields = "__all__"
        depth = 2

class OrderedRegionSer(serializers.ModelSerializer):
    class Meta:
        model = OrderedRegion
        exclude = ('create_time', 'is_delete')
        depth = 1